home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / langs / xlisp2.1 / xldist01.zoo / lsp / stepper.doc < prev    next >
Encoding:
Text File  |  1990-11-09  |  3.8 KB  |  103 lines

  1. The attached listing is a step debugger inspired by the "step.lsp"
  2. stepper included with XLISP 2.1, originally written by Jonathan Engdahl
  3. (jengdahl on BIX).  This version has the ability to set/reset
  4. breakpoints, and a few bells and whistles.
  5.  
  6. To invoke the stepper:
  7.     (step (form with args))
  8.  
  9. The stepper will stop and print every form, then wait for user input. 
  10. Forms are printed compressed, i.e. only atoms at the top 2 paren. level
  11. are printed.  The user may change the compression factor.  Example:
  12. Suppose you have the following defined:
  13.  
  14. (defun fib (n)
  15.   (if ((or (eql n 1) (eql n 2))
  16.       1
  17.       (+ (fib (- n 2)) (fib (- n 1))))))
  18.  
  19. Then (step (fib 4)) will produce the following:
  20.  
  21. 0 >==> (fib 4)
  22.  1 >==> (if (**) 1 (+ ** **)) :
  23.  
  24. The colon is the stepper's prompt.  For a list of commands, type h<cr>. 
  25. All stepper commands are terminated by a return, <cr>.  Typing h<cr>
  26. produces:
  27.  
  28. Stepper Commands 
  29. ----------------
  30.           n - next form
  31.           s - step over form
  32.  f FUNCTION - go until FUNCTION is called
  33.  b FUNCTION - set breakpoint at FUNCTION
  34.  b <list>   - set breakpoint at each function in list
  35.  c FUNCTION - clear breakpoint at FUNCTION
  36.  c <list>   - clear breakpoint at each function in list
  37.  c *all*    - clear all breakpoints
  38.           g - go until a breakpoint is reached
  39.           w - where am I? -- backtrace
  40.           q - quit stepper, continue execution
  41.           t - toggle trace on/off
  42.           p - pretty-print current form (uncompressed)
  43.           e - print environment
  44.   x <expr> - execute expression in current environment
  45.        * nn - set list compression to nn
  46.           h - print this summary
  47.   All commands are terminated by <cr>
  48.  1 >==> (if (**) 1 (+ ** **)) :
  49.  
  50. Breakpoints may be set with the b command.  You may set breakpoints at
  51. on function, e.g. b FOO<cr> sets a breakpoint at the function FOO,
  52. or at various functions at once, e.g. b (FOO FIE FUM)<cr> sets
  53. breakpoints at the functions FOO, FIE, and FUM.  Breakpoints are cleared
  54. with the c command in an analogous way.  Furthermore, a special form of
  55. the c command, c *all* <cr>, clears all previously set breakpoints. 
  56. Breakpoints are remembered from one invocation of step to the next, so
  57. it is only neccessary to set them once in a debugging session.
  58.  
  59. The g command causes execution to proceed until a breakpoint is reached,
  60. at which time more stepper commands can be entered.
  61.  
  62. The f command sets a temporary breakpoint at one function, and causes
  63. execution to proceed until that function is called.
  64.  
  65. The w command prints a back trace.
  66.  
  67. The q command quits and causes execution to continue uninterrupted.
  68.  
  69. Entry and exit to functions are traced after a g, f, or q command.  To
  70. turn off tracing, use the t command which toggles the trace on/off. 
  71. Also, with trace off, the values of function parameters are not printed.
  72.  
  73. The s command causes the current form to be evaluated.
  74.  
  75. The n command steps into the current form.
  76.  
  77. The * command changes the compression of displayed forms.  E.g. in the
  78. previous example:
  79.  
  80.  1 >==> (if (**) 1 (+ ** **)) : * 3    ; change compression to 3 ...
  81.  1 >==> (if (or (eql n 1) (eql n 2)) 1 (+ (fib **) (fib **))) :
  82.  
  83. To have the entire form printed, set the compression to 300 or some
  84. outrageously high value, or just use the p command, which pretty-prints
  85. the form uncompressed.  The d command simply displays the compressed
  86. form again.
  87.  
  88. The e command causes the current environment to be printed;  the x
  89. command causes an expression to be executed in the current environment. 
  90. Note that this permits the user to alter values while the program is
  91. running, and may affect execution of the program.
  92.  
  93. I hope this is of some value to you all.  Feel free to make any
  94. changes/enhancements.  Regards,
  95.                 Ray.
  96.  
  97. Ray Comas, comas@math.lsa.umich.edu
  98. ------------------------------------
  99. Remember, Finite Groups are your FRIENDS!!
  100. ------------------------------------
  101.  
  102.  
  103.